package com.mall.malladminbackend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mall.malladminbackend.dto.Create;
import com.mall.malladminbackend.entity.SysUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {

    // 获取到用户的权限
    Set<String> getPermsOfUser(String username);

    //查询所有用户及部门信息
    List<SysUser> selectAll(String name,String email,String mobile);

    //根据用户id删除对应的角色
    int deleteByUserId(long userId);

    //根据用户添加对应的角色关系
    int insertRoleByUserId(@Param("userId") long userId,@Param("ids") int[] ids, @Param("create")Create create);

    //根据用户id删除
    int delete(Integer id);

    //根据id查用户
    SysUser selectById(Integer id);

    //修改用户状态
    int updateStatus(@Param("status") boolean status, @Param("id") Integer id);

    //修改用户信息
    int update(@Param("sysUser") SysUser sysUser,@Param("create") Create create);

    //增加用户
    int insert(@Param("sysUser") SysUser sysUser,@Param("create") Create create);
}